/**
 * @name cfg-gen
 * @id python/cfg-gen
 */

import python
import util


from File f,ControlFlowNode node,BasicBlock block,Scope scope,string node_type,string node_value,string last_node_type,string last_node_value,string last_node_location,string filepath,string node_location,string block_location
where
node.getScope().getEnclosingModule().getFile()=f
and
filepath=f.getAbsolutePath()
and
scope=node.getScope()
and
isSource(f)
and
block.contains(node)
and
prepare_cfg_node_id(node, node_type, node_value, node_location)
and
prepare_basicblock_node_id(block, last_node_type, last_node_value, filepath, last_node_location, block_location)

select node,block,node_type,node_value,last_node_type,last_node_value,scope,filepath,block_location,node_location,last_node_location


// from File f,ControlFlowNode parent,ControlFlowNode child,BasicBlock basicBlock,string filepath,string location
// where
// parent.getScope().getEnclosingModule().getFile()=f
// and
// (child=parent.getASuccessor() or child.isEntryNode())
// and
// location=getLocText(child.getLocation())
// and
// filepath=f.getAbsolutePath()
// and
// isSource(f)
// and
// basicBlock.contains(child)
// select parent,child,basicBlock,filepath,location